package flockingGA;

public class GAState {
	/*
	 * 0 == Init params
	 * 1 == Start game
	 * 2 == End game
	 * 3 == Update params/score
	 */
	private int state = 0;
	private double score;
	private Parameters params;
	
	public GAState()
	{
		Parameters p = Parameters.loadFromFile();
		if ( p == null )
			this.setParams(new Parameters());
	}
	
	public synchronized int getState()
	{
		return this.state;
	}

	public synchronized double getScore() {
		this.state = 0;
		System.out.println("Get Score");
		return score;
	}
	
	public synchronized void setParams(Parameters params) {
		this.state = 1;
		this.params = params;
		this.params.saveToFile();
		System.out.println("Set params");
	}
	
	public synchronized Parameters getParams() {
		this.state = 2;
		System.out.println("Get params");
		return params;
	}

	public synchronized void setScore(double score) {
		this.score = score;
		this.state = 3;
		System.out.println("set Score");
	}

}
